// 入口
const cloud = require('wx-server-sdk') 
cloud.init({
  env: "cytfadmini-1gali3r244372a1f" 
})

// 云函数入口函数
// 功能：修改字段BlockVolunteer的值
exports.main = async (event, context) => {
  var {DBname,volid,userInfo,...mypara} = event
  // 获取共享环境
  var c1 = new cloud.Cloud({
    resourceAppid: 'wxbfd52ca8da22670f',
    resourceEnv: 'cloud1-4gcsxcql7d341258',
  })
  await c1.init()
  const db = c1.database()
  try {
    c1.database().collection(DBname) 
      .where({
        _openid:volid,
      })
      .update({
        data: mypara
        // {
        //   BlockVolunteer:1,
        // },
      })
  } catch(e) {
    console.error(e)
  }
}